package com.lovo;

import com.alibaba.fastjson.JSON;
import com.lovo.config.RedisCacheUtil;
import com.lovo.dao.ISysCommodityDao;
import com.lovo.dto.BuyerDto;
import com.lovo.entity.SysCommodityEntity;
import com.lovo.service.ISysCommodityService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.List;

@SpringBootTest
@RunWith(SpringRunner.class)
public class Rt {

    @Autowired
    RedisCacheUtil redisCacheUtil;
    @Test
    public void  T(){
        BuyerDto buyerDto=new BuyerDto();
        buyerDto.setNum(1);
        buyerDto.setProductName("好多鱼");
       buyerDto.setPrice(2);
       buyerDto.setProductId(1);
        redisCacheUtil.hset("1","1",buyerDto);



    }

    @Test
    public void  G(){
//           Object o=redisCacheUtil.hget("1","1");
//       String obj=  JSON.toJSONString(o);
//        BuyerDto buyerDto=JSON.parseObject(obj,BuyerDto.class);
//        System.out.println(buyerDto);

        redisCacheUtil.hdel("1","1");
    }

    @Autowired
    ISysCommodityService sysCommodityService;

    @Autowired
    ISysCommodityDao sysCommodityDao;



    @Test
    public void shangJia(){

        sysCommodityService.listings(2,500,"2.jpg","aaaaaaaa");
    }
    @Test
    public void infoFull(){
        List<SysCommodityEntity> list= sysCommodityDao.findAllByInfo("一");
        for (SysCommodityEntity entity:list) {
            System.err.println(entity.getInfo());
        }
    }


    @Test
    public void infoFaaull(){
        for (int i = 0; i <1000 ; i++) {
            System.out.println(System.currentTimeMillis());
        }

    }

}
